package org.example.repository.dialect.memory;

import lombok.extern.slf4j.Slf4j;
import org.example.repository.ConditionalOnDriver;
import org.example.repository.RepositoryFactory;
import org.example.repository.SchemaSynchronizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnDriver(havingValue = "memory", matchIfMissing = true)
@Slf4j
public class InMemoryRepositoryConfig {

    @Bean
    public SchemaSynchronizer defaultSchemaSynchronizer() {
        log.info("create default schemaSynchronizer");
        return new InMemorySchemaSynchronizer();
    }

    @Bean
    public RepositoryFactory defaultRepositoryFactory() {
        log.info("create default repositoryFactory");
        return new InMemoryRepositoryFactory();
    }
}
